package atguigu.lst;

public class CompResult {

    private String checkNodeType;
    private String msg;
    private double min;
    private double max;
    private double value;

    public CompResult(String checkNodeType, double min, double max, double value) {
        this.checkNodeType = checkNodeType;
        this.min = min;
        this.max = max;
        this.value = value;
    }

    public Boolean isExcepton() {
        boolean exp = false; // 没有异常
        if (value >= min && value <= max) {
            exp = false;
        } else {
            exp = true; // 有异常
        }
        return exp;
    }

    private String getMsg() {
        if (isExcepton()) {
            return checkNodeType + value + "(" + min + "/" + max + ")";
        }
        return msg;
    }

    public String getCheckNodeType() {
        return checkNodeType;
    }

    public void setCheckNodeType(String checkNodeType) {
        this.checkNodeType = checkNodeType;
    }

    // getter setter
    public double getMin() {
        return min;
    }

    public void setMin(double min) {
        this.min = min;
    }

    public double getMax() {
        return max;
    }

    public void setMax(double max) {
        this.max = max;
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return getMsg();
    }
}
